package com.bestcem.xm.survey.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bestcem.xm.component.mybatis.base.BaseEntity2;
import com.bestcem.xm.component.mybatis.format.String2JacksonSerializer;
import com.bestcem.xm.survey.config.StringValue2FastJsonSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @TableName ds_survey_column
 */
@TableName(value = "ds_survey_column")
@Data
@EqualsAndHashCode(callSuper = true)
public class SurveyColumn extends BaseEntity2 {
    /**
     *
     */
    @TableId(value = "id")
    private String id;

    /**
     * 问卷id
     */
    @TableField(value = "project_id")
    @JsonProperty("project_id")
    @JSONField(name = "project_id")
    private String projectId;

    /**
     * 表示列在哪些问卷版本中
     */
    @TableField(value = "qstruct_ids")
    @JsonProperty("qstruct_ids")
    @JsonSerialize(using = String2JacksonSerializer.class)
    @JSONField(name = "qstruct_ids", serializeUsing = StringValue2FastJsonSerializer.class)
    private String qstructIds;

    /**
     * 题目gid
     */
    @TableField(value = "gid")
    private Integer gid;

    /**
     * 题型
     */
    @TableField(value = "disp_type")
    @JsonProperty("disp_type")
    @JSONField(name = "disp_type")
    private String dispType;

    /**
     * 矩阵行gid，矩阵行开放
     */
    @TableField(value = "rgid")
    private Integer rgid;

    /**
     * 选项gid，问题字段填空框时存在值
     */
    @TableField(value = "ogid")
    private Integer ogid;

    /**
     * 元数据、联系人列名
     */
    @TableField(value = "col")
    @JSONField(name = "col")
    private String col;

    /**
     * 题目字段类型，用来列排序
     */
    @TableField(value = "qtype")
    private Integer qtype;

    /**
     * 列状态
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 用来列排序
     */
    @TableField(value = "ctype")
    private Integer ctype;

    /**
     * 存储一些前端需要的属性
     */
    @TableField(value = "custom_attr")
    @JsonProperty("custom_attr")
    @JsonSerialize(using = String2JacksonSerializer.class)
    @JSONField(name = "custom_attr", serializeUsing = StringValue2FastJsonSerializer.class)
    private String customAttr;

    /**
     * 用来列排序，每种ctype、qtype从0开始累加，排序通过ctype、sort_no
     */
    @TableField(value = "sort_no")
    @JsonProperty("sort_no")
    @JSONField(name = "sort_no")
    private Integer sortNo;
}